home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / util / misc / defaultscr_v10.lha / DefaultScreen.s < prev   
Text File  |  1995-01-08  |  2KB  |  133 lines

  1. ;
  2. ; DefaultScreen is Copyright © 1994 by Stefano Reksten of 3AM.
  3. ; It was made just to learn how to use the ReadArgs() function and the
  4. ; LINK/UNLK instructions (these make the program 100 bytes smaller! :-)
  5. ;
  6. ; This program changes the default public screen and can set the
  7. ; SHANGHAI and POPPUBSCREEN flags, if passed the correct arguments.
  8. ; I know there are other utilities like (my) PSM to manage public screens,
  9. ; but not as small as this one!
  10. ;
  11. ; To contact me:
  12. ;
  13. ; rekststef@unisi.it
  14. ;
  15. ; Stefano Reksten c/o Naimi
  16. ; v.le Cavour, 40
  17. ; 53100 SIENA - Italy
  18. ;
  19.     incdir    "include:"
  20.     include "LVO3.0/exec_lib.i"
  21.     include "LVO3.0/dos_lib.i"
  22.     include "LVO3.0/intuition_lib.i"
  23.  
  24. SHANGHAI    equ    $0001
  25. POPPUBSCREEN    equ    $0002
  26.  
  27. DOSBase        equ    0
  28. IntuiBase    equ    4
  29. ArgsPtr        equ    8
  30. Args        equ    12
  31. ScrName        equ    12
  32. SFLG        equ    16
  33. PFLG        equ    20
  34.  
  35.     link    a5,#-24
  36.     move.l    4,a6
  37.     lea    IntuiName(PC),a1
  38.     move.l    #37,d0
  39.     jsr    _LVOOpenLibrary(a6)
  40.     beq.w    .intuiexit
  41.     move.l    d0,IntuiBase(SP)
  42.  
  43.     lea    DOSName(PC),a1
  44.     move.l    #37,d0
  45.     jsr    _LVOOpenLibrary(a6)
  46.     beq.w    .dosexit
  47.     move.l    d0,DOSBase(SP)
  48.  
  49.     move.l    d0,a6
  50.     move.l    #Template,d1
  51.     move.l    SP,d2
  52.     add.l    #Args,d2
  53.     moveq    #0,d3
  54.     jsr    _LVOReadArgs(a6)
  55.     beq.b    .noscrname
  56.  
  57.     move.l    d0,ArgsPtr(SP)
  58.  
  59.     move.l    ScrName(SP),d0
  60.     tst.l    d0
  61.     beq.b    .noscrname
  62.  
  63.     move.l    IntuiBase(SP),a6
  64.  
  65.     move.l    d0,a0
  66.     jsr    _LVOLockPubScreen(a6)
  67.  
  68.     tst    d0
  69.     beq.b    .nopublic
  70.  
  71.     move.l    ScrName(SP),a0
  72.     jsr    _LVOSetDefaultPubScreen(a6)
  73.  
  74.     moveq    #0,d0
  75.     tst    SFLG(SP)
  76.     beq.b    .noshanghai
  77.     or    #SHANGHAI,d0
  78. .noshanghai
  79.     tst    PFLG(SP)
  80.     beq.b    .nopopup
  81.     or    #POPPUBSCREEN,d0
  82. .nopopup
  83.     jsr    _LVOSetPubScreenModes(a6)
  84.  
  85.     move.l    #0,a0
  86.     move.l    d0,a1
  87.     jsr    _LVOUnlockPubScreen(a6)
  88.     
  89.     bra.b    .freeargs
  90.  
  91. .nopublic
  92.     move.l    DOSBase(SP),a6
  93.     move.l    #ErrNoPublic,d1
  94.     move.l    SP,d2
  95.     add.l    #Args,d2
  96.     jsr    _LVOVPrintf(a6)
  97.     bra.b    .freeargs
  98.     
  99. .noscrname
  100.     move.l    #ErrNoName,d1
  101.     jsr    _LVOVPrintf(a6)
  102.     
  103. .freeargs
  104.     move.l    DOSBase(SP),a6
  105.     move.l    ArgsPtr(SP),d1
  106.     jsr    _LVOFreeArgs(a6)
  107.     move.l    4,a6
  108.     move.l    DOSBase(SP),a1
  109.     jsr    _LVOCloseLibrary(a6)
  110. .dosexit
  111.     move.l    IntuiBase(SP),a1
  112.     jsr    _LVOCloseLibrary(a6)
  113. .intuiexit
  114.     unlk    a5
  115.     rts
  116.  
  117. DOSName
  118.     dc.b    'dos.library',0
  119. IntuiName
  120.     dc.b    'intuition.library',0
  121.     even
  122. Template
  123.     dc.b    'ScreenName/A,S=Shanghai/S,P=PopScreen/S',0
  124.     even
  125.     dc.b    '$VER: DefaultScreen v1.0 (8.1.95)',$A,0
  126.     even
  127. ErrNoName
  128.     dc.b    'No public screen name given',$A,0
  129.     even
  130. ErrNoPublic
  131.     dc.b    '%s is not a public screen',$A,0
  132.     even
  133.